@echo off

SET choice=a

set SCRUBBER_EXE_FILE=not_defined
if EXIST ..\..\setup\hpzscr01.exe SET SCRUBBER_EXE_FILE=..\..\setup\hpzscr01.exe
if EXIST hpzscr01.exe SET SCRUBBER_EXE_FILE=hpzscr01.exe
if "%SCRUBBER_EXE_FILE%" == "not_defined" goto MISSING_SCRUBBER_EXE

set SCRUBBER_DAT_FILE=not_defined
if EXIST ..\..\setup\hpfscr05.dat SET SCRUBBER_DAT_FILE=hpfscr05.dat
if EXIST hpfscr05.dat SET SCRUBBER_DAT_FILE=hpfscr05.dat


if EXIST %TEMP%\PIPN1.tmp goto LEVEL2

echo ******************** Executing Level1 CleanUP *********************
echo The possible cause may be
echo 1. There was a communication Problem with the device while installing
echo 2. There was an error while printing or scanning
echo *******************************************************************
echo.
echo.
echo If you chose to UNINSTALL, Please do the following...
echo 1. Unplug the USB cable from the back of your HP Deskjet device
echo 2. After the cleanup finishes, restart your computer and wait for Windows 
echo    to start up
echo 3. Reconnect the USB cable to your HP Deskjet device and wait for the 
echo    installation process to finish
echo 4. Try printing a document to confirm functionality
echo.
echo.

if Windows_NT==%OS% GOTO WIN2K_XP
GOTO WIN9x_ME

:WIN2K_XP
echo Press ENTER to continue Uninstalling... 
echo              OR 
echo Press Q followed by ENTER to QUIT Uninstallation

SET /P Choice=

IF /I ‘%choice:~0,1%’==’Q’ GOTO END_QUIT

GOTO DISPLAY

:WIN9x_ME
choice /C:cq Press Q to quit Uninstall OR press C to continue...
if ERRORLEVEL==2 GOTO END_QUIT
if ERRORLEVEL==1 GOTO DISPLAY

GOTO END_QUIT

:DISPLAY

if "%SCRUBBER_DAT_FILE%" == "not_defined" goto MISSING_SCRUBBER_DAT
start /wait %SCRUBBER_EXE_FILE% -datfile %SCRUBBER_DAT_FILE_CDA% -unattended -showdisconnect -nocopytotemp -d MsiUninstaller,TaskUninstaller,RemoveProgramUninstaller,ScannerUninstaller,AiONetworkDriveUninstaller,PrinterUninstaller,DriverUninstaller,ServiceUninstaller,PortUninstaller,RsmUninstaller,RegistryUninstaller,FileUninstaller,MonitorUninstaller,ProcessShutdown,WindowShutdown

copy uninstall_L1.bat %TEMP%\PIPN1.tmp

goto END

:MISSING_SCRUBBER_DAT
echo "**** Uninstall file not found: hpfscr??.dat ****"
goto EXIT

:MISSING_SCRUBBER_EXE
echo "**** Uninstall file not found: hpzscr01.exe ****"
goto EXIT




:LEVEL2
call Uninstall_L2.BAT
goto END_LAST

:END
echo Uninstallation Completed.

:END_QUIT
echo DONE.
pause

:END_LAST


:EXIT